/*
 *    Copyright (c) 2018-2025, cloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cloud
 */

package com.fuyao.cloud.asset.entity.borrow;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuyao.cloud.asset.util.AssetUtils;
import com.fuyao.cloud.common.core.model.BaseEntity;
import com.fuyao.cloud.common.core.enums.EnumContext;
import com.fuyao.cloud.common.core.model.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 借用&归还表
 *
 * @author ly
 * @date 2022-01-06 10:37:40
 */
@Data
@TableName("fy_asset_borrow")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "借用&归还表")
public class Borrow extends BaseEntity<Borrow> {

	private static final long serialVersionUID = 1L;

	public final static String BORROW_CASE_TYPE = "borrow";

	/**
	 * 借用状态
	 */
	public final static String BORROW = "0";

	/**
	 * 归还状态
	 */
	public final static String REMAND = "1";

	/**
	 * 唯一编码（用于关联附件）
	 */
	@ApiModelProperty(value = "唯一编码（用于关联附件）")
	private String unid;

	/**
	 * 单号
	 */
	@ApiModelProperty(value = "单号")
	private String caseid;


	@ApiModelProperty(value="状态：默认为0{0:已生效，1:审批中，2:待签字，3:已驳回}")
	private String status;

	@ApiModelProperty(value = "默认为0{0：借用、1：归还}")
	private String type;

	/**
	 * 借用人ID
	 */
	@ApiModelProperty(value = "借用人ID")
	private Long borrowId;
	@ApiModelProperty(value = "借用人姓名")
	private String borrowName;
	@ApiModelProperty(value = "借用人所属OU的ID")
	private Long borrowOuid;
	@ApiModelProperty(value = "借用人所属OU的全称")
	private String borrowOufullname;
	@ApiModelProperty(value = "借用人所属OU的名称")
	private String borrowOuname;

	@ApiModelProperty(value = "归还人ID")
	private Long remandId;
	@ApiModelProperty(value = "归还人姓名")
	private String remandName;
	@ApiModelProperty(value = "归还人所属OU的ID")
	private Long remandOuid;
	@ApiModelProperty(value = "归还人所属OU的全称")
	private String remandOufullname;
	@ApiModelProperty(value = "归还人所属OU的名称")
	private String remandOuname;

	/**
	 * 借用时间
	 */
	@ApiModelProperty(value = "借用时间")
	private LocalDateTime borrowTime;

	/**
	 * 预计归还时间
	 */
	@ApiModelProperty(value = "预计归还时间")
	private LocalDateTime forecastRemandTime;

	/**
	 * 实际归还时间
	 */
	@ApiModelProperty(value = "实际归还时间")
	private LocalDateTime realRemandTime;

	/**
	 * 说明
	 */
	@ApiModelProperty(value = "说明")
	private String explains;

	@ApiModelProperty(value="订单明细")
	private String detailed;

	public String getDetailedEx() {
		return AssetUtils.formatDetailed(this.detailed);
	}


	@TableField(exist = false)
	@ApiModelProperty(value="借用明细")
	private List<BorrowList> borrowList;


}
